Skip to content

Conversation

@matthiasblaesing
Copy link
Contributor

Restore clipboard history for editor:

Bildschirmfoto vom 2025-04-27 12-29-39

@matthiasblaesing matthiasblaesing added Platform [ci] enable platform tests (platform/*) ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) labels Apr 27, 2025
@matthiasblaesing matthiasblaesing added this to the NB26 milestone Apr 27, 2025
@matthiasblaesing
Copy link
Contributor Author

Test:

  1. Build NetBeans from the target branch
  2. Open nbbuild/licenses/Apache-2.0-ASF
  3. Mark first word of the document and copy to clipboard
  4. Call Clipboard history
  5. Repeat steps 3+4 until "ASF" is marked. Ensure that while doing this the NB windows as focus the whole time.

Expected result: All words of the sentence of "Licensed to the Apache Software Foundation (ASF)" should be in the clipboard history as individual entries.

Observed result: No entry in history

Reproduced on:
On github/delivery (acc6180)
Ubuntu 25.04 (with Amazon Corretto 17.0.9.8.1)
Windows 10 (with OpenJDK 24)

Verified on
On f17455c
Same OS/JVM set as reproducer

@mbien
Copy link
Member

mbien commented Apr 27, 2025

this is meant to target delivery, right?

@matthiasblaesing matthiasblaesing changed the base branch from master to delivery April 27, 2025 17:56
@matthiasblaesing
Copy link
Contributor Author

Yes

@apache apache locked and limited conversation to collaborators Apr 27, 2025
@apache apache unlocked this conversation Apr 27, 2025
Copy link
Member

@mbien mbien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense (tested on linux and it populated the clipboard history while copying things from the editor).

Would update the PR title since this is mostly about the history feature and not necessarily windows specific.

@matthiasblaesing matthiasblaesing changed the title Stabilize copy'n'paste one windows by using ExClipboard instead of directly accessing system clipboard Restore clipboard history for editor by using ExClipboard instead of directly accessing system clipboard Apr 27, 2025
@matthiasblaesing
Copy link
Contributor Author

Updated. Given the history I'm not inclined to do much more on this.

Copy link
Member

@neilcsmith-net neilcsmith-net left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks @matthiasblaesing !

Yes, I don't think there's anything more to do. This should hopefully cover the vast majority of cases people expect this to work.

@ebarboni
Copy link
Contributor

making this PR for 26-rc3

@ebarboni ebarboni merged commit 0b40a9d into apache:delivery Apr 29, 2025
64 checks passed
@mbien
Copy link
Member

mbien commented Apr 29, 2025

changes here seem to make java.editor ClipboardHandlerTest fail often. I can reproduce it locally.
https://github.com/apache/netbeans/actions/runs/14726753775

haven't really looked into it yet

@mbien
Copy link
Member

mbien commented Apr 30, 2025

could be harmless, timing changes make a test fail much more often.

Copy/paste works, however the test is sometimes failing when it compares the output before the autoimport-on-paste feature finished.

putting a breakpoint or a 200ms sleep at this spot stabilizes it - I hate the current test stability situation.

actually: this works only while running a single test case, not the full test

edit: NbClipboard itself is asynchronous, the test is assuming copy/paste are blocking operations, see #8476. Essentially the situation as in #8455.

@neilcsmith-net
Copy link
Member

NbClipboard itself is asynchronous, the test is assuming copy/paste are blocking operations,

Which they were. I was curious why returning the copy behaviour to that before #7928 was now causing a test failure. But of course, we're not returning the paste behaviour to the old behaviour, which would have called through NbClipboard::getContents and blocked on the pending change.

I think we need some thought about whether it's desirable to keep the NbClipboard asynchronous behaviour? It could just be for content listening with synchronous behaviour? Or we could force syncing the clipboard in the basekit paste action - https://github.com/apache/netbeans/blob/master/ide/editor.lib/src/org/netbeans/editor/BaseKit.java#L2399 ??

Given that and where we are at with NB26, we might consider it safer to pull this and reconsider for NB27?

@mbien
Copy link
Member

mbien commented Apr 30, 2025

Given that and where we are at with NB26, we might consider it safer to pull this and reconsider for NB27?

I would probably also take the safer option and keep it as is for now. Although I couldn't come up with many scenarios where something would programmatically copy things around similar to the unit tests.

@neilcsmith-net neilcsmith-net added the Release process PRs (eg. versions, sync) that are part of the release process and can be ignored in release notes. label May 7, 2025
@matthiasblaesing matthiasblaesing deleted the exclipboard2 branch November 27, 2025 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:dev-build [ci] produce a dev-build zip artifact (7 days expiration, see link on workflow summary page) Platform [ci] enable platform tests (platform/*) Release process PRs (eg. versions, sync) that are part of the release process and can be ignored in release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants